﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls;
using System.Drawing;
using Silvermoon.Animations;
using Silvermoon.Controls.Classes;
using Silvermoon.OpenGL;

namespace FileExplorer
{
    public class ConfirmDialog : Dialog
    {
        private Label label;
        private TextBox titleBox;

        public ConfirmDialog(string title, string message)
            : this()
        {
            titleBox.Text = title;
            Message = message;
        }

        public ConfirmDialog()
            : base()
        {
            Load(false);
        }

        public ConfirmDialog(string title, string message, bool isMessageBox)
            : base()
        {
            Load(isMessageBox);
            titleBox.Text = title;
            Message = message;
        }
        private void Load(bool isMessageBox)
        {
            Height = 340;
            //Margin = new Margin(0, null, 0, 0);
            Margin = new Margin(10, 100, 10, null);
            Alpha = 220;
            HideTransition = TransitionMode.ZoomOut | TransitionMode.FadeOut;

            // we add two DialogButtons here, one with Result=DialogResult.OK and another with Result=DialogResult.Cancel:
            Controls.Add(new DialogButton { Text = "OK", Color = Color.Green, Size = new Size(160, 64), Margin = new Margin(null, null, 16+170, 16), Result = DialogResult.OK, Style= Silvermoon.Visuals.RenderStyle.Chrome });
            if (!isMessageBox)
            {
                Controls.Add(new DialogButton
                                 {
                                     Text = "Cancel",
                                     Color = Color.Red,
                                     Size = new Size(160, 64),
                                     Margin = new Margin(null, null, 16, 16),
                                     Result = DialogResult.Cancel,
                                     Style = Silvermoon.Visuals.RenderStyle.Chrome
                                 });
            }
            label = new Label
                        {
                            Margin = new Margin(16),
                            LineMode = Silvermoon.OpenGL.LineMode.WordWrap,
                            Alignment = Alignment.Center,
                            //Font = FontSprite.Bold,
                            Text = "Confirm"
                        };


            titleBox = new TextBox { Text = "Confirm delete", Height = 48, Margin = new Margin(16, 16, 16, null), Enabled = false };
            Controls.Add(titleBox);
            TextureDecorator td = new TextureDecorator
                                      {
                                          Margin = new Margin(16, 16 + 52, 16, 16 + 68),
                                          TextColor = Color.White,
                                          Color = Color.Black,
                                          Gradianted = false,
                                          Control = label
                                      };
            Controls.Add(td);
        }

        public string Message
        {
            get { return label.Text; }
            set { label.Text = value; }
        }
    }
}
